<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Shop_name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-shop_name" class="form-control" name="row[shop_name]" type="text" data-rule="required"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Shop_no')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-shop_no" class="form-control" name="row[shop_no]" type="text" placeholder="请输入门牌编号,若不填系统自动生成"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Phone')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-phone" class="form-control" name="row[phone]" type="text" data-rule="required"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Logo')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-logo" class="form-control" size="50" name="row[logo]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-logo" class="btn btn-danger faupload" data-input-id="c-logo" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-logo"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-logo" class="btn btn-primary fachoose" data-input-id="c-logo" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-logo"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-logo"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Order_tc_rate')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-order_tc_rate" class="form-control" name="row[order_tc_rate]" type="text" />
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Province')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-province" class="form-control" name="row[province]" data-rule="required">
                <option value=''>请选择</option>
                {foreach name="oneLvlList" item="item"}
                <option value="{$item.id}" >{$item.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('City')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-city"  class="form-control" name="row[city]" data-rule="required">
                <option value=''>请选择</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Area')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-area" class="form-control " name="row[area]" data-rule="required">
                <option value=''>请选择</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Business_hours')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-business_hours" class="form-control" name="row[business_hours]" type="text" placeholder="例如：00:00 - 18:00">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Describe')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-describe" class="form-control " rows="5" name="row[describe]" cols="50"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Is_voluntarily_order')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                {foreach name="isFouList" item="vo"}
                <label for="row[is_voluntarily_order]-{$key}"><input id="row[is_voluntarily_order]-{$key}" name="row[is_voluntarily_order]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Is_voluntarily_print')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                {foreach name="isFouList" item="vo"}
                <label for="row[is_voluntarily_print]-{$key}"><input id="row[is_voluntarily_print]-{$key}" name="row[is_voluntarily_print]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Address')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-address" class="form-control " data-input-id="c-address" data-lng-id="c-lng" data-lat-id="c-lat" data-toggle="addresspicker" data-rule="required" name="row[address]" type="text" value="{if isset($row.address)}{$row.address|htmlentities}{/if}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Lng')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-lng" class="form-control" name="row[lng]" type="text" readonly>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-3">{:__('Lat')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-lat" class="form-control" name="row[lat]" type="text" readonly>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-3"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<!-- jQuery -->
<script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script type = "text/javascript" >
    $(function () {
        $('#c-province').change(function () {
            var pid = $(this).val();

            $.post('shop/shop/getCity',{'pid':pid},function (data)
            {
                if (data . status) {
                    var html = "<option value=''>请选择</option>";
                    $.each(data . data, function (i,item){
                        html += "<option value=" + item . id + ">" + item . name + "</option>";
                    });
                    $('#c-city') . html(html);
                } else {
                    alert(data . msg);
                }
            },'json');
        });


        $('#c-city').change(function () {
            var pid = $(this).val();

            $.post('shop/shop/getCity',{'pid':pid},function (data)
            {

                if (data . status) {
                    if (data . status) {
                        var html = "<option value=''>请选择城市</option>";
                        $.each(data . data, function (i,item){
                            html += "<option value=" + item . id + ">" + item . name + "</option>";
                        });
                        $('#c-area') . html(html);
                    } else {
                        alert(data . msg);
                    }

                } else {
                    alert(data . msg);
                }
            },'json');
        });
    });
</script >